<?php
//------------------------
// 资讯验证器
//-------------------------

namespace app\common\validate;

use think\Validate;

class Article extends Validate
{
    protected $rule = [
        'title|资讯标题'          => 'require|max:128|unique:article',
        'cid|资讯分类'            => 'require',
        'author|作者'             => 'max:64',
        'keyword|关键字'          => 'max:128',//\S{1,18}[,]?
        'content|资讯内容'        => 'require',
        'sort_num|排序值'         => 'number',
    ];

    protected $message = [
        'cid.require'           => '请选择资讯分类',
        // 'keyword.\S{1,18}[,]?'  => '关键字必须用全英逗号分割开，单个关键字不允许超过6个汉字字符',
    ];


    protected $scene = [
        'add'  => ['title', 'cid','author','keyword','content'],
        'sort_num'  => ['sort_num'],
    ];

}